package cn.wen.eeayjoke.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.view.View;
import android.widget.ImageView;

import butterknife.BindView;
import cn.wen.core.titlebar.DefTitleBar;
import cn.wen.core.titlebar.StatusBarUtil;
import cn.wen.core.ui.AppActivity;
import cn.wen.eeayjoke.MainActivity;
import cn.wen.eeayjoke.R;

/**
 * 欢迎页面
 */

public class WelcomeActivity extends AppActivity {
    @BindView(R.id.iv_icon)
    ImageView mIvIcon;

    @Override
    protected Object getContentLayout() {
        return R.layout.activity_welcome;
    }

    @Override
    protected void initTitle(DefTitleBar titleBar) {

    }

    @Override
    protected boolean isNeedTitle() {
        return false;
    }

    @Override
    protected void initView(View contentView) {
        StatusBarUtil.setStatusBarColor(this);
        ObjectAnimator alpha = ObjectAnimator.ofFloat(mIvIcon, "alpha", 0f, 1f);
        alpha.setDuration(1000);
        alpha.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                startActivity(MainActivity.class);
                finish();
            }
        });
        alpha.start();

    }
}
